package com.chaos.eurekaproducer.test;

/**
 * @author liaopeng
 * @title: DynamicDispatch
 * @projectName eureka-producer
 * @description: TODO
 * @date 2021/6/22下午10:15
 */
public class DynamicDispatch{
    static abstract class Human{
        protected abstract void sayHello();
    }

    static class Man extends Human{
        @Override
        protected void sayHello() {
            System.out.println("hello man");
        }
    }

    static class Woman extends Human{
        @Override
        protected void sayHello() {
            System.out.println("hello woman");
        }
    }

    public static void main(String[] args) {
        Human man = new Man();
        Human woman = new Woman();
        man.sayHello();
        woman.sayHello();
        man = new Woman();
        man.sayHello();
    }
}
